<include file="Public:header" />

<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>

<link type="text/css" rel="stylesheet" href="__ROOT__/Public/bootstrap/css/bootstrap.min.css"/>

<script type="text/javascript">

    var d = "{$jsApiParameters | default = ''}";

    if (!d) {

        d = {};

        alert("jsApiParameters初始化错误");
    }

    //调用微信JS api 支付
    function jsApiCall()
    {
        WeixinJSBridge.invoke(
                'getBrandWCPayRequest', d,
                function (res) {
                    WeixinJSBridge.log(res.err_msg);

                    switch (res.err_msg) {
                        case 'get_brand_wcpay_request:cancel':
                            alert("您取消了支付");
                            break;
                        case 'get_brand_wcpay_request:fail':
                            alert("支付失败");
                            break;
                        case 'get_brand_wcpay_request:ok':
                            alert("支付成功");
                            window.href.location = "{:U('Member/order')}";
                            break;
                    }
                }
        );
    }

    function callpay()
    {
        if (typeof WeixinJSBridge == "undefined") {
            if (document.addEventListener) {
                document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
            } else if (document.attachEvent) {
                document.attachEvent('WeixinJSBridgeReady', jsApiCall);
                document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
            }
        } else {
            jsApiCall();
        }
    }


</script>

<div id="main">
    
    <include file="Public:procat" />

    <div class="goodslist" style="padding:0 5px; color:#666">

        <notempty name="products">

            <table border="0" cellpadding="0" cellspacing="0" style="width:100%;border-radius:5px; border:1px solid #ededed; margin-top:8px; padding-bottom:8px;">

                <volist name="products" id="vo" >

                    <tr>

                        <td style="width:25%; text-align:center; height:80px; padding-top:10px; overflow:hidden;">
                            <img src="{$vo.cover|get_cover}" title="{$vo.title}" border="0" style="width:80px; border:1px solid #ededed; padding:1px; margin-left:5px;">
                        </td>

                        <td align="left" valign="top">
                            <p style="padding-left:10px; padding-top:10px">
                                {$vo.title}
                            </p>
                            <p style=" padding-left:10px;font-size:14px;">专柜价:<del style="color:#FF0000;">￥{$vo.original_price|default='0.00'}</del>&nbsp;&nbsp;&nbsp;惊喜价:<font color="#FF0000">￥{$vo.price}</font></p>
                            <p style="padding-left:10px;">数量:×{$vo.count}<b style="margin-left:3px;"></b>&nbsp;&nbsp;小计:<font color="#FF0000">￥{$vo['price']*$vo['count']}</font></p>
                        </td>

                    </tr>

                </volist>

                <tr>
                    <td> </td>
                    <td style=' padding-left:10px;'> 总价:<span style="color:red; font-size:18px">￥{$total}</span></td>
                    <td> </td>
                </tr>

            </table>

        </notempty> 

    </div>

    <div class="form-group">
        <a class="btn btn-success btn-block" onclick="callpay()">微信支付</a>
    </div>

</div>

<style>
    .form-group{position:fixed; max-width: 620px; width:100%; bottom: 36px }
</style>

<include file="Public:footer" />